home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / yiear.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  12KB  |  383 lines

  1. /***************************************************************************
  2.  
  3.     Yie Ar Kung-Fu memory map (preliminary)
  4.     enrique.sanchez@cs.us.es
  5.  
  6. CPU:    Motorola 6809
  7.  
  8. Normal 6809 IRQs must be generated each video frame (60 fps).
  9. The 6809 NMI is used for sound timing.
  10.  
  11.  
  12. 0000          R    VLM5030 status ???
  13. 4000          W  control port
  14.                     bit 0 - flip screen
  15.                     bit 1 - NMI enable
  16.                     bit 2 - IRQ enable
  17.                     bit 3 - coin counter A
  18.                     bit 4 - coin counter B
  19. 4800          W    sound latch write
  20. 4900          W  copy sound latch to SN76496
  21. 4a00          W  VLM5030 write
  22. 4b00          W  VLM5030 start
  23. 4c00        R   DSW #0
  24. 4d00        R   DSW #1
  25. 4e00        R   IN #0
  26. 4e01        R   IN #1
  27. 4e02        R   IN #2
  28. 4e03        R   DSW #2
  29. 4f00          W  watchdog
  30. 5000-502f     W  sprite RAM 1 (18 sprites)
  31.                     byte 0 - bit 0 - sprite code MSB
  32.                              bit 6 - flip X
  33.                              bit 7 - flip Y
  34.                     byte 1 - Y position
  35. 5030-53ff    RW  RAM
  36. 5400-542f    W  sprite RAM 2
  37.                     byte 0 - X position
  38.                     byte 1 - sprite code LSB
  39. 5430-57ff    RW  RAM
  40. 5800-5fff    RW  video RAM
  41.                     byte 0 - bit 4 - character code MSB
  42.                              bit 6 - flip Y
  43.                              bit 7 - flip X
  44.                     byte 1 - character code LSB
  45. 8000-ffff    R   ROM
  46.  
  47.  
  48. ***************************************************************************/
  49.  
  50. #include "driver.h"
  51. #include "vidhrdw/generic.h"
  52. #include "cpu/m6809/m6809.h"
  53.  
  54.  
  55. void yiear_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  56. void yiear_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  57. WRITE_HANDLER( yiear_videoram_w );
  58. WRITE_HANDLER( yiear_control_w );
  59. int  yiear_nmi_interrupt(void);
  60.  
  61. /* in sndhrdw/trackfld.c */
  62. WRITE_HANDLER( konami_SN76496_latch_w );
  63. WRITE_HANDLER( konami_SN76496_0_w );
  64.  
  65.  
  66.  
  67. static READ_HANDLER( yiear_speech_r )
  68. {
  69.     return rand();
  70.     /* maybe bit 0 is VLM5030 busy pin??? */
  71.     if (VLM5030_BSY()) return 1;
  72.     else return 0;
  73. }
  74.  
  75. static WRITE_HANDLER( yiear_speech_st_w )
  76. {
  77.     /* no idea if this is correct... */
  78.     VLM5030_ST( 1 );
  79.     VLM5030_ST( 0 );
  80. }
  81.  
  82.  
  83. static struct MemoryReadAddress readmem[] =
  84. {
  85.     { 0x0000, 0x0000, yiear_speech_r },
  86.     { 0x4c00, 0x4c00, input_port_3_r },
  87.     { 0x4d00, 0x4d00, input_port_4_r },
  88.     { 0x4e00, 0x4e00, input_port_0_r },
  89.     { 0x4e01, 0x4e01, input_port_1_r },
  90.     { 0x4e02, 0x4e02, input_port_2_r },
  91.     { 0x4e03, 0x4e03, input_port_5_r },
  92.     { 0x5000, 0x5fff, MRA_RAM },
  93.     { 0x8000, 0xffff, MRA_ROM },
  94.     { -1 } /* end of table */
  95. };
  96.  
  97. static struct MemoryWriteAddress writemem[] =
  98. {
  99.     { 0x4000, 0x4000, yiear_control_w },
  100.     { 0x4800, 0x4800, konami_SN76496_latch_w },
  101.     { 0x4900, 0x4900, konami_SN76496_0_w },
  102.     { 0x4a00, 0x4a00, VLM5030_data_w },
  103.     { 0x4b00, 0x4b00, yiear_speech_st_w },
  104.     { 0x4f00, 0x4f00, watchdog_reset_w },
  105.     { 0x5000, 0x502f, MWA_RAM, &spriteram, &spriteram_size },
  106.     { 0x5030, 0x53ff, MWA_RAM },
  107.     { 0x5400, 0x542f, MWA_RAM, &spriteram_2 },
  108.     { 0x5430, 0x57ff, MWA_RAM },
  109.     { 0x5800, 0x5fff, videoram_w, &videoram, &videoram_size },
  110.     { 0x8000, 0xffff, MWA_ROM },
  111.     { -1 } /* end of table */
  112. };
  113.  
  114.  
  115.  
  116. INPUT_PORTS_START( yiear )
  117.     PORT_START    /* IN0 */
  118.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  119.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  120.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  121.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  122.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  123.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  124.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  125.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  126.  
  127.     PORT_START    /* IN1 */
  128.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  129.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  130.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  131.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  132.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  133.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  134.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  135.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  136.  
  137.     PORT_START    /* IN2 */
  138.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  139.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  140.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  141.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  142.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  143.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  144.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
  145.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  146.  
  147.     PORT_START    /* DSW0 */
  148.     PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
  149.     PORT_DIPSETTING(    0x03, "1" )
  150.     PORT_DIPSETTING(    0x02, "2" )
  151.     PORT_DIPSETTING(    0x01, "3" )
  152.     PORT_DIPSETTING(    0x00, "5" )
  153.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  154.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  155.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  156.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
  157.     PORT_DIPSETTING(    0x08, "30000 80000" )
  158.     PORT_DIPSETTING(    0x00, "40000 90000" )
  159.     PORT_DIPNAME( 0x10, 0x10, "Unknown DSW1 4" )
  160.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  161.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  162.     PORT_DIPNAME( 0x20, 0x20, "Difficulty?" )
  163.     PORT_DIPSETTING(    0x20, "Easy" )
  164.     PORT_DIPSETTING(    0x00, "Hard" )
  165.     PORT_DIPNAME( 0x40, 0x40, "Unknown DSW1 6" )
  166.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  167.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  168.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  169.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  170.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  171.  
  172.     PORT_START    /* DSW1 */
  173.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  174.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  175.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  176.     PORT_DIPNAME( 0x02, 0x02, "Number of Controllers" )
  177.     PORT_DIPSETTING(    0x02, "1" )
  178.     PORT_DIPSETTING(    0x00, "2" )
  179.     PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
  180.     PORT_DIPNAME( 0x08, 0x08, "Unknown DSW2 4" )
  181.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  182.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  183.     PORT_DIPNAME( 0x10, 0x10, "Unknown DSW2 5" )
  184.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  185.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  186.     PORT_DIPNAME( 0x20, 0x20, "Unknown DSW2 6" )
  187.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  188.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  189.     PORT_DIPNAME( 0x40, 0x40, "Unknown DSW2 7" )
  190.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  191.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  192.     PORT_DIPNAME( 0x80, 0x80, "Unknown DSW2 8" )
  193.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  194.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  195.  
  196.     PORT_START    /* DSW2 */
  197.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  198.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  199.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  200.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  201.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  202.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  203.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  204.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  205.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  206.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  207.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  208.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  209.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  210.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  211.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  212.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  213.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  214.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  215.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  216.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  217.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  218.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  219.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  220.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  221.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  222.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  223.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  224.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  225.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  226.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  227.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  228.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  229.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  230.     /* 0x00 gives invalid */
  231. INPUT_PORTS_END
  232.  
  233.  
  234.  
  235. static struct GfxLayout charlayout =
  236. {
  237.     8,8,    /* 8x8 characters */
  238.     512,    /* 512 characters */
  239.     4,        /* 4 bits per pixel */
  240.     { 4, 0, 512*16*8+4, 512*16*8+0 },    /* plane offsets */
  241.     { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
  242.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  243.     16*8    /* each character takes 16 bytes */
  244. };
  245.  
  246. static struct GfxLayout spritelayout =
  247. {
  248.     16,16,    /* 16x16 sprites */
  249.     512,    /* 512 sprites */
  250.     4,        /* 4 bits per pixel */
  251.     { 4, 0, 512*64*8+4, 512*64*8+0 },    /* plane offsets */
  252.     { 0*8*8+0, 0*8*8+1, 0*8*8+2, 0*8*8+3, 1*8*8+0, 1*8*8+1, 1*8*8+2, 1*8*8+3,
  253.       2*8*8+0, 2*8*8+1, 2*8*8+2, 2*8*8+3, 3*8*8+0, 3*8*8+1, 3*8*8+2, 3*8*8+3 },
  254.     {  0*8,  1*8,  2*8,  3*8,  4*8,  5*8,  6*8,  7*8,
  255.       32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  256.     64*8    /* each sprite takes 64 bytes */
  257. };
  258.  
  259. static struct GfxDecodeInfo gfxdecodeinfo[] =
  260. {
  261.     { REGION_GFX1, 0, &charlayout,   16, 1 },
  262.     { REGION_GFX2, 0, &spritelayout,  0, 1 },
  263.     { -1 } /* end of array */
  264. };
  265.  
  266.  
  267.  
  268. struct SN76496interface sn76496_interface =
  269. {
  270.     1,            /* 1 chip */
  271.     { 1500000 },    /*  1.5 MHz ? (hand tuned) */
  272.     { 100 }
  273. };
  274.  
  275. struct VLM5030interface vlm5030_interface =
  276. {
  277.     3580000,    /* master clock  */
  278.     100,        /* volume        */
  279.     REGION_SOUND1,    /* memory region  */
  280.     0,          /* memory size of speech rom */
  281.     0            /* VCU            */
  282. };
  283.  
  284.  
  285.  
  286. static struct MachineDriver machine_driver_yiear =
  287. {
  288.     /* basic machine hardware */
  289.     {
  290.         {
  291.             CPU_M6809,
  292.             1250000,    /* 1.25 Mhz */
  293.             readmem, writemem, 0, 0,
  294.             interrupt,1,    /* vblank */
  295.             yiear_nmi_interrupt,500    /* music tempo (correct frequency unknown) */
  296.         }
  297.     },
  298.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  299.     1,    /* single CPU, no need for interleaving */
  300.     0,
  301.  
  302.     /* video hardware */
  303.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  304.     gfxdecodeinfo,
  305.     32, 32,
  306.     yiear_vh_convert_color_prom,
  307.  
  308.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  309.     0,
  310.     generic_vh_start,
  311.     generic_vh_stop,
  312.     yiear_vh_screenrefresh,
  313.  
  314.     /* sound hardware */
  315.     0,0,0,0,
  316.     {
  317.         {
  318.             SOUND_SN76496,
  319.             &sn76496_interface
  320.         },
  321.         {
  322.             SOUND_VLM5030,
  323.             &vlm5030_interface
  324.         }
  325.     }
  326. };
  327.  
  328.  
  329. /***************************************************************************
  330.  
  331.   Game driver(s)
  332.  
  333. ***************************************************************************/
  334.  
  335. ROM_START( yiear )
  336.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  337.     ROM_LOAD( "i08.10d",      0x08000, 0x4000, 0xe2d7458b )
  338.     ROM_LOAD( "i07.8d",       0x0c000, 0x4000, 0x7db7442e )
  339.  
  340.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  341.     ROM_LOAD( "g16_1.bin",    0x00000, 0x2000, 0xb68fd91d )
  342.     ROM_LOAD( "g15_2.bin",    0x02000, 0x2000, 0xd9b167c6 )
  343.  
  344.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  345.     ROM_LOAD( "g04_5.bin",    0x00000, 0x4000, 0x45109b29 )
  346.     ROM_LOAD( "g03_6.bin",    0x04000, 0x4000, 0x1d650790 )
  347.     ROM_LOAD( "g06_3.bin",    0x08000, 0x4000, 0xe6aa945b )
  348.     ROM_LOAD( "g05_4.bin",    0x0c000, 0x4000, 0xcc187c22 )
  349.  
  350.     ROM_REGION( 0x0020, REGION_PROMS )
  351.     ROM_LOAD( "yiear.clr",    0x00000, 0x0020, 0xc283d71f )
  352.  
  353.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* 8k for the VLM5030 data */
  354.     ROM_LOAD( "a12_9.bin",    0x00000, 0x2000, 0xf75a1539 )
  355. ROM_END
  356.  
  357. ROM_START( yiear2 )
  358.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  359.     ROM_LOAD( "d12_8.bin",    0x08000, 0x4000, 0x49ecd9dd )
  360.     ROM_LOAD( "d14_7.bin",    0x0c000, 0x4000, 0xbc2e1208 )
  361.  
  362.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  363.     ROM_LOAD( "g16_1.bin",    0x00000, 0x2000, 0xb68fd91d )
  364.     ROM_LOAD( "g15_2.bin",    0x02000, 0x2000, 0xd9b167c6 )
  365.  
  366.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  367.     ROM_LOAD( "g04_5.bin",    0x00000, 0x4000, 0x45109b29 )
  368.     ROM_LOAD( "g03_6.bin",    0x04000, 0x4000, 0x1d650790 )
  369.     ROM_LOAD( "g06_3.bin",    0x08000, 0x4000, 0xe6aa945b )
  370.     ROM_LOAD( "g05_4.bin",    0x0c000, 0x4000, 0xcc187c22 )
  371.  
  372.     ROM_REGION( 0x0020, REGION_PROMS )
  373.     ROM_LOAD( "yiear.clr",    0x00000, 0x0020, 0xc283d71f )
  374.  
  375.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* 8k for the VLM5030 data */
  376.     ROM_LOAD( "a12_9.bin",    0x00000, 0x2000, 0xf75a1539 )
  377. ROM_END
  378.  
  379.  
  380.  
  381. GAME( 1985, yiear,  0,     yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 1)" )
  382. GAME( 1985, yiear2, yiear, yiear, yiear, 0, ROT0, "Konami", "Yie Ar Kung-Fu (set 2)" )
  383.